<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class Invoice extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('invoice', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->unsignedBigInteger('order_id')->comment('订单ID');
            $table->decimal('money',10,2)->nullable()->comment('发票金额');
            $table->tinyInteger('type')->default(1)->comment('抬头类型，1企业单位，2个人/非企业单位');
            $table->string('name')->nullable()->comment('公司名称');
            $table->string('num')->nullable()->comment('公司税号');
            $table->unsignedBigInteger('user_id')->default(0)->comment('申请人ID');
            $table->string('user_nickname')->nullable()->comment('申请人昵称');
            $table->unsignedBigInteger('check_user_id')->default(0)->comment('审核人ID');
            $table->string('check_user_nickname')->nullable()->comment('审核人昵称');
            $table->tinyInteger('check_status')->default(1)->comment('审核状态：1审核中，2审核不通过，3审核通过，默认1');
            $table->string('check_result')->nullable()->comment('审核结果');
            $table->dateTime('check_time')->nullable()->comment('审核时间');
            $table->text('multiple_file')->nullable()->comment('发票截图');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('invoice');
    }
}
